<?php
/**
 * Provides / and /index/* pages
 */
class IndexController extends BRail_Application_Controller_Abstract
{
    /**
     * / page
     * @return void
     */
    public function indexAction()
    {
        $table = new CarouselItemTable();
        $carouselItems = $table->getAvailableItem("store_picture");

        $this->view->carouselPictures = $carouselItems;

        $this->_updateAuthenticationToken();
    }

    /**
     * Update AuthenticationToken in session
     * @param string $name
     * @return string authentication token
     */
    private function _updateAuthenticationToken($name = '')
    {
        $session = new Zend_Session_Namespace('session');
        $options = Zend_Registry::get('Zend_Application_Options');
        $session->authenticationToken = md5($options['authentication_token'] . $name . time());
        return $session->authenticationToken;
    }
}